{php include wl_template('common/header');}
<ul class="nav nav-tabs" id="myTab">
	<li class="active"><a href="#tab_basic">提现设置</a></li>
	<li class="sysallocation"><a href="#tab_cash">结算设置</a></li>
</ul>
<div class="app-content">
	<div class="app-form">
		<form action="" method="post" class="form-horizontal form form-validate" >
			<div class="panel-heading">财务设置</div>
			<div class="tab-content">
				<div class="tab-pane active" id="tab_basic">
					<div class="sysallocation">
						<div class="form-group">
							<label class="col-sm-2 control-label">商户预留金额</label>
							<div class="col-sm-9">
								<div class="input-group">
									<span class="input-group-addon">￥</span>
									<input type="text" name="cashset[reservemoney]" class="form-control" value="{$cashset['reservemoney']}" />
								</div>
								<div class="help-block">提现后，商户账户余额必须大于预留金额。</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" >提现金额限制</label>
							<div class="col-sm-9">
								<div class="input-group">
									<span class="input-group-addon">最小￥</span>
									<input type="number" mid="0" name="cashset[lowsetmoney]" class="form-control" value="{$cashset['lowsetmoney']}" />
									<span class="input-group-addon">最大￥</span>
									<input type="number" mid="0" name="cashset[maxsetmoney]" class="form-control" value="{$cashset['maxsetmoney']}" />
								</div>
								<div class="help-block">设置为0时，没有金额的大小限制。</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" >提现间隔时间</label>
							<div class="col-sm-9">
								<div class="input-group">
									<input type="text" name="cashset[shopIntervalTime]" class="form-control" value="{$cashset['shopIntervalTime']}" />
									<span class="input-group-addon">天</span>
								</div>
								<div class="help-block">为0天时，则没有间隔时间！</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">打款方式</label>
							<div class="col-sm-9">
								<label class="checkbox-inline">
									<input type="checkbox" name="cashset[payment_type][alipay]" value="1" {if $cashset['payment_type']['alipay'] == 1}checked{/if}> 支付宝
								</label>
								<label class="checkbox-inline">
									<input type="checkbox" name="cashset[payment_type][we_chat]" value="1" {if $cashset['payment_type']['we_chat'] == 1}checked{/if}> 微信
								</label>
								<label class="checkbox-inline">
									<input type="checkbox" name="cashset[payment_type][bank_card]" value="1" {if $cashset['payment_type']['bank_card'] == 1}checked{/if}> 银行卡
								</label>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">微信打款账号</label>
							<div class="col-sm-9">
								<select name="cashset[wechat_payment]" class="form-control">
									<option value="-1">请选择微信打款账号</option>
									{loop $weChat $item}
										<option value="{$item['id']}" {if $item['id'] == $cashset['wechat_payment']} selected="selected" {/if}>{$item['name']}</option>
									{/loop}
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">微信打款产品</label>
							<div class="col-sm-9">
								<label class="radio-inline">
									<input type="radio" value="0" name="cashset[wechatapitype]" {if $cashset['wechatapitype'] == 0 || empty($cashset['wechatapitype'])} checked {/if} /> 企业付款到零钱
								</label>
								<label class="radio-inline">
									<input type="radio" value="1" name="cashset[wechatapitype]" {if $cashset['wechatapitype'] == 1} checked {/if} /> 商家转账到零钱
								</label>
								<div class="help-block">微信支付企业付款到零钱产品整合到商家转账到零钱，已经开通企业付款到零钱的客户可以继续使用，未开通的用户请开通商家转账到零钱。商家转账到零钱功能必须使用v3秘钥。</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">支付宝打款账号</label>
							<div class="col-sm-9">
								<select name="cashset[alipay_payment]" class="form-control">
									<option value="-1">请选择支付宝打款账号</option>
									{loop $aliPay $item}
										<option value="{$item['id']}" {if $item['id'] == $cashset['alipay_payment']} selected="selected" {/if}>{$item['name']}</option>
									{/loop}
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" >默认商家提现手续费</label>
							<div class="col-sm-9">
								<div class="input-group">
									<input type="text" name="cashset[syssalepercent]" class="form-control" value="{$cashset['syssalepercent']}" />
									<span class="input-group-addon">%</span>
								</div>
								<div class="help-block">代理详情中未设置时，会调用这里的默认比例</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label" >默认代理提现手续费</label>
							<div class="col-sm-9">
								<div class="input-group">
									<input type="text" name="cashset[agentpercent]" class="form-control" value="{$cashset['agentpercent']}" />
									<span class="input-group-addon">%</span>
								</div>
								<div class="help-block">代理详情中未设置时，会调用这里的默认比例</div>
							</div>
						</div>
						{if !empty($isAuth)}
						<div class="form-group">
							<label class="col-sm-2 control-label">微信分账</label>
							<div class="col-sm-9">
								<label class="radio-inline" onclick="$('.wxallocation').hide();">
									<input type="radio" value="0" name="cashset[allocationtype]" {if $cashset['allocationtype'] == 0 || empty($cashset['allocationtype'])} checked {/if} /> 关闭
								</label>
								<label class="radio-inline" onclick="$('.wxallocation').show();">
									<input type="radio" value="1" name="cashset[allocationtype]" {if $cashset['allocationtype'] == 1} checked {/if} /> 微信服务商分账
								</label>
								<div class="help-block">服务商分账时微信商户官方提供的分账方式，需要为每个商家、代理单独设置支付子商户,目前微信只开放了低比例分账，请注意平台，代理{if Customized::init('distributionText') > 0}共享股东{else}分销商{/if}分账比例之和不能超过30%,开启此项设置后，如果未设置商户与代理支付项，会按照之前方式结算。</div>
							</div>
						</div>
						{/if}
					</div>
					<div class="wxallocation" {if $cashset['allocationtype'] == 0 || empty($cashset['allocationtype'])} style="display: none;" {/if}>
					{if p('wxplatform')}
<!--						<div class="panel-heading">微信公众号设置</div>-->
<!--						<div class="form-group">-->
<!--							<label class="col-sm-2 control-label">平台分账方账户类型</label>-->
<!--							<div class="col-sm-9">-->
<!--								<select name="cashset[wxsysalltype]" onchange="changewx(this)" class="form-control">-->
<!--									<option value="0" > - 请选择账户类型 - </option>-->
<!--									<option value="1" {if $cashset['wxsysalltype'] == 1} selected="selected" {/if}>微信商户</option>-->
<!--									<option value="2" {if $cashset['wxsysalltype'] == 2} selected="selected" {/if}>个人零钱</option>-->
<!--								</select>-->
<!--							</div>-->
<!--						</div>-->
<!--						<div class="form-group wxsysalldiv1" {if $cashset['wxsysalltype'] != 1} style="display: none;" {/if} >-->
<!--							<label class="col-sm-2 control-label">微信商户号</label>-->
<!--							<div class="col-sm-9">-->
<!--								<div class="input-group" style="width:100%">-->
<!--									<input type="number" name="cashset[wxmerchantid]" class="form-control" value="{$cashset['wxmerchantid']}" />-->
<!--								</div>-->
<!--							</div>-->
<!--						</div>-->
<!--						<div class="form-group wxsysalldiv1" {if $cashset['wxsysalltype'] != 1} style="display: none;" {/if} >-->
<!--							<label class="col-sm-2 control-label">微信商户名称</label>-->
<!--							<div class="col-sm-9">-->
<!--								<div class="input-group" style="width:100%">-->
<!--									<input type="text" name="cashset[wxmerchantname]" class="form-control" value="{$cashset['wxmerchantname']}" />-->
<!--								</div>-->
<!--							</div>-->
<!--						</div>-->
<!--						<div class="form-group wxsysalldiv2" {if $cashset['wxsysalltype'] != 2} style="display: none;" {/if} >-->
<!--							<label class="col-sm-2 control-label">分账微信用户</label>-->
<!--							<div class="col-sm-9">-->
<!--								{php echo tpl_select_user('cashset[wxallmid]', $cashset['wxallmid']);}-->
<!--							</div>-->
<!--						</div>-->
						<div class="form-group">
							<label class="col-sm-2 control-label" >平台公众号端分成比例</label>
							<div class="col-sm-9">
								<div class="input-group">
									<input type="number" name="cashset[wxsyspercent]" class="form-control" value="{$cashset['wxsyspercent']}" />
									<span class="input-group-addon">%</span>
								</div>
								<div class="help-block">公众号订单的平台分成比例。</div>
							</div>
						</div>
						{/if}
						{if p('wxapp')}
<!--						<div class="panel-heading">微信小程序设置</div>-->
<!--						<div class="form-group">-->
<!--							<label class="col-sm-2 control-label">平台分账方账户类型</label>-->
<!--							<div class="col-sm-9">-->
<!--								<select name="cashset[appsysalltype]" onchange="changeapp(this)" class="form-control">-->
<!--									<option value="0" > - 请选择账户类型 - </option>-->
<!--									<option value="1" {if $cashset['appsysalltype'] == 1} selected="selected" {/if}>微信商户</option>-->
<!--									<option value="2" {if $cashset['appsysalltype'] == 2} selected="selected" {/if}>个人零钱</option>-->
<!--								</select>-->
<!--							</div>-->
<!--						</div>-->
<!--						<div class="form-group appsysalldiv1" {if $cashset['appsysalltype'] != 1} style="display: none;" {/if} >-->
<!--							<label class="col-sm-2 control-label">微信商户号</label>-->
<!--							<div class="col-sm-9">-->
<!--								<div class="input-group" style="width:100%">-->
<!--									<input type="number" name="cashset[appmerchantid]" class="form-control" value="{$cashset['appmerchantid']}" />-->
<!--								</div>-->
<!--							</div>-->
<!--						</div>-->
<!--						<div class="form-group appsysalldiv1" {if $cashset['appsysalltype'] != 1} style="display: none;" {/if} >-->
<!--							<label class="col-sm-2 control-label">微信商户名称</label>-->
<!--							<div class="col-sm-9">-->
<!--								<div class="input-group" style="width:100%">-->
<!--									<input type="text" name="cashset[appmerchantname]" class="form-control" value="{$cashset['appmerchantname']}" />-->
<!--								</div>-->
<!--							</div>-->
<!--						</div>-->
<!--						<div class="form-group appsysalldiv2" {if $cashset['appsysalltype'] != 2} style="display: none;" {/if} >-->
<!--							<label class="col-sm-2 control-label">分账微信用户</label>-->
<!--							<div class="col-sm-9">-->
<!--								{php echo tpl_select_user('cashset[appallmid]', $cashset['appallmid']);}-->
<!--							</div>-->
<!--						</div>-->
						<div class="form-group">
							<label class="col-sm-2 control-label" >平台小程序端分成比例</label>
							<div class="col-sm-9">
								<div class="input-group">
									<input type="number" name="cashset[appsyspercent]" class="form-control" value="{$cashset['appsyspercent']}" />
									<span class="input-group-addon">%</span>
								</div>
								<div class="help-block">小程序订单的平台分成比例。</div>
							</div>
						</div>
						{/if}
					</div>
					<!--用户余额提现设置到时候写到用户设置-->
					<div class="form-group">
						<label class="col-sm-2 control-label">用户余额提现</label>
						<div class="col-sm-9">
							<label class="radio-inline" onclick="$('#withdrawals').show()">
								<input type="radio" value="1" name="cashset[withdrawals]" {if $cashset['withdrawals'] == 1} checked {/if} /> 开启
							</label>
							<label class="radio-inline" onclick="$('#withdrawals').hide()">
								<input type="radio" value="0" name="cashset[withdrawals]" {if $cashset['withdrawals'] == 0 || empty($cashset['withdrawals'])} checked {/if} /> 禁用
							</label>
							<div class="help-block">开启后，用户可以提现自己的余额。</div>
						</div>
					</div>
					<div class="form-group" id="withdrawals"  {if $cashset['withdrawals'] == 0 || empty($cashset['withdrawals'])} style="display: none;" {/if} >
						<label class="col-sm-2 control-label" >用户提现余额手续费比例</label>
						<div class="col-sm-9">
							<div class="input-group">
								<input type="text" name="cashset[memberpercent]" class="form-control" value="{$cashset['memberpercent']}" />
								<span class="input-group-addon">%</span>
							</div>
							<div class="help-block">用户余额提现的比例</div>
						</div>
					</div>
				</div>
				<div class="tab-pane" id="tab_cash">
					<div class="form-group">
						<label class="col-sm-2 control-label">商户代理提现免审核</label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" value="1" name="cashset[noaudit]" {if $cashset['noaudit'] == 1} checked {/if} /> 开启
							</label>
							<label class="radio-inline">
								<input type="radio" value="0" name="cashset[noaudit]" {if $cashset['noaudit'] == 0 || empty($cashset['noaudit'])} checked {/if} /> 禁用
							</label>
							<div class="help-block">开启后，商户代理提现申请会自动标记为待打款订单。</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">{if Customized::init('distributionText') > 0}共享股东{else}分销{/if}提现免审核</label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" value="1" name="cashset[disnoaudit]" {if $cashset['disnoaudit'] == 1} checked {/if} /> 开启
							</label>
							<label class="radio-inline">
								<input type="radio" value="0" name="cashset[disnoaudit]" {if $cashset['disnoaudit'] == 0 || empty($cashset['disnoaudit'])} checked {/if} /> 禁用
							</label>
							<div class="help-block">开启后，{if Customized::init('distributionText') > 0}共享股东{else}分销{/if}提现申请会自动标记为待打款订单。</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">代理自动打款</label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" value="1" name="cashset[agentautocash]" {if $cashset['agentautocash'] == 1} checked {/if} /> 开启
							</label>
							<label class="radio-inline">
								<input type="radio" value="0" name="cashset[agentautocash]" {if $cashset['agentautocash'] == 0 || empty($cashset['agentautocash'])} checked {/if} /> 禁用
							</label>
							<div class="help-block">开启后,待打款记录会自动打款给代理,只对实际到账金额大于1元的微信提现和支付宝转账有效</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">商户自动打款</label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" value="1" name="cashset[autocash]" {if $cashset['autocash'] == 1} checked {/if} /> 开启
							</label>
							<label class="radio-inline">
								<input type="radio" value="0" name="cashset[autocash]" {if $cashset['autocash'] == 0 || empty($cashset['autocash'])} checked {/if} /> 禁用
							</label>
							<div class="help-block">开启后,待打款记录会自动打款给商家,只对实际到账金额大于1元的微信提现和支付宝转账有效</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">{if Customized::init('distributionText') > 0}共享股东{else}分销{/if}自动打款</label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" value="1" name="cashset[disautocash]" {if $cashset['disautocash'] == 1} checked {/if} /> 开启
							</label>
							<label class="radio-inline">
								<input type="radio" value="0" name="cashset[disautocash]" {if $cashset['disautocash'] == 0 || empty($cashset['disautocash'])} checked {/if} /> 禁用
							</label>
							<div class="help-block">开启后，待打款记录会自动打款给{if Customized::init('distributionText') > 0}共享股东{else}分销商{/if},只对实际到账金额大于1元的微信提现,余额提现和支付宝转账有效</div>
						</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label"></label>
				<div class="col-sm-9">
					<input type="submit" name="submit" value="提交" class="btn btn-primary min-width" />
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</div>
		</form>
	</div>
</div>

<script>
	$(function () {
		$('#myTab a').click(function (e) {
			e.preventDefault();//阻止a链接的跳转行为
			$('.spec_item_item .layui-unselect').remove();  //挽救规格页面的错误css
			$(this).tab('show');//显示当前选中的链接及关联的content
		});
	});

	function changewx(asd){
		var type = $(asd).val();
		if(type == 1){
			$('.wxsysalldiv2').hide();
			$('.wxsysalldiv1').show();
		}else if(type == 2){
			$('.wxsysalldiv1').hide();
			$('.wxsysalldiv2').show();
		}else{
			$('.wxsysalldiv1').hide();
			$('.wxsysalldiv2').hide();
		}
	}

	function changeapp(asd){
		var type = $(asd).val();
		if(type == 1){
			$('.appsysalldiv2').hide();
			$('.appsysalldiv1').show();
		}else if(type == 2){
			$('.appsysalldiv1').hide();
			$('.appsysalldiv2').show();
		}else{
			$('.appsysalldiv1').hide();
			$('.appsysalldiv2').hide();
		}
	}

</script>
{php include wl_template('common/footer');}